import { reqUserAddress, reqTradeInfo } from '@/api'
export default {
  state: {
    address: [],
    tradeInfo: {}
  },
  mutations: {
    GETUSERADDRESS(state, address) {
      state.address = address
    },
    GETTRADEINFO(state, tradeInfo) {
      state.tradeInfo = tradeInfo
    }
  },
  actions: {
    // 获取用户地址信息
    async getUserAddress({ commit }) {
      const res = await reqUserAddress()
      if (res.code === 200) {
        commit('GETUSERADDRESS', res.data)
      }
    },
    // 获取订单页信息
    async getTradeInfo({ commit }) {
      const res = await reqTradeInfo()
      if (res.code === 200) {
        commit('GETTRADEINFO', res.data)
      }
    }
  },
  getters: {}
}
